<%--
  Created by IntelliJ IDEA.
  User: 张波
  Date: 2025/8/22
  Time: 10:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<html>
<head>
    <title>addPage</title>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
</head>
<body>
<button id="btn1">发送json格式user数据</button>
<button id="btn2">发送json格式userList数据</button>
</body>
<script>

    document.getElementById("btn1").onclick = function () {
        var UserData = {"name":"赵六","age":"19","id":"1"}
        $.ajax({
            type:"POST",
            url:"/arg5",
            data:JSON.stringify(UserData),
            contentType:"application/json;charset=utf-8"
        });
    }
    document.getElementById("btn2").onclick = function () {
        var userList = new Array();
        userList.push({name:"zhangsan",age:18,id:222});
        userList.push({name:"lisi",age:28,id:333});
        $.ajax({
            type:"POST",
            url:"/arg6",
            data:JSON.stringify(userList),
            contentType:"application/json;charset=utf-8"
        });
    }


    $.ajax({
        type:"POST",
        url:"${pageContext.request.contextPath}/user/quick15",
        data:JSON.stringify(userList),
        contentType:"application/json;charset=utf-8"
    });


</script>
</html>
